package com.heima.apis.article;

import com.heima.apis.article.fallback.ArticleFeignClientFallback;
import com.heima.model.article.dtos.ArticleDto;
import com.heima.model.article.pojos.ApArticle;
import com.heima.model.common.dtos.ResponseResult;
import org.springframework.boot.actuate.autoconfigure.web.server.ConditionalOnManagementPort;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

@FeignClient(value = "leadnews-article",fallbackFactory = ArticleFeignClientFallback.class)
public interface ArticleFeignClient {

    /**
     *远程调用接口（自媒体文章发布审核通过后，调用文章中的文章保存方法，将自媒体文章保存到app端的文章表中）
     * @param articleDto
     * @return
     */
    @PostMapping("/api/v1/article/save")
    ResponseResult<Long> saveArticle(@RequestBody ArticleDto articleDto);

    /**
     * 根据id查询
     * @param id
     * @return
     */
    @PostMapping("/api/v1/article/{id}")
    ResponseResult<ApArticle> findArticleById(@PathVariable("id") Integer id);
}
